home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 751-760 / 752 / toolmanager / goodies / upd1_20.lha / upd / Upd.Doc < prev    next >
Text File  |  1992-08-05  |  14KB  |  388 lines

  1. Release 1.20
  2.  
  3.         The minimal player daemon - upd
  4.         ===============================
  5.  
  6.     © 1991 Jonas Petersson & Absolut Software (aka Sirius Soft)
  7.  
  8.  
  9.  
  10. Introduction:
  11. =============
  12.  
  13. Wouldn't it be nice to have a process hanging around to play any
  14. sound file for you on demand instead of you having to do all this
  15. mucking about with audio.device etc? But it really has to be small
  16. and it HAS to be able to play my very large samples anytime...
  17. I must be able to call it simply from anywhere - even from scripts!
  18.  
  19. Tricky, but it can be done.
  20.  
  21. As a feature you can register you favourite sounds in a configuration
  22. file and well behaved programs will use the ones you like right now.
  23. It also has Arexx support - to be truely honest, that the ONLY way to
  24. use it... As of 1.01, there is also a fade option.
  25.  
  26. Actually, "minimal" is not quite true anymore as speech is available
  27. starting 1.20... As a spin-off of this you also get a "say" program
  28. that can play phonemes.
  29.  
  30. Current version works rather well along the way I intended.
  31.  
  32.  
  33. Usage:
  34. ======
  35. **** Note: rehacked interface
  36.  
  37.     [run] upd [-bBUFSIZE] [-fIDFILE] [-pPRIORITY]
  38.  
  39. The "run" is of course optional, but daemons really should be in the
  40. background unless you want the see the debugging information.  "bufsize"
  41. is the amount of chip memory that each of the four buffers will use
  42. while playing.  (These are allocated at start to make sure you will be
  43. able to play anytime - as long as you can get hold of the audio
  44. channels...).  Default is 1024 and specifying less than 64 will give you
  45. the default. (I've heard that some people can't ever get anything good
  46. out with less than a 1K buffer - am I really the only one with a quick
  47. enough HD/SCSI interface?) 
  48.  
  49. NOTE: Don't make the buffer bigger than you actually need - a large
  50. buffer also means that the sample will start a little bit later since
  51. more information must be loaded before it can begin!
  52.  
  53. If the IDfile parameter exists, it will be used instead of the
  54. default s:upd.IDs. 
  55.  
  56. As of 1.20 I've also added the priority option to satisfy some requests
  57. from people who prefer their sound to be perfect before getting things
  58. done... You people may specify -p35 or something like that along with
  59. some huge buffer. Of course, you can also lower priority with this option.
  60.  
  61. The above won't produce any sound as you probably realise.  Once run, the
  62. only way to talk to upd is with Arexx - I even removed the BREAK stuff
  63. that was in it for Zound, since Arexx could hang around waiting for a
  64. reply forever when you interupted the sound that way. The break will
  65. "wait" until the daemon is idle next time.
  66.  
  67. upd currently knows of these commands:
  68.  
  69.     file filepath [options] [anotherfilepath [options]]
  70.     id   id-in-s:upd.IDs
  71.         rescan new-id-file
  72.     fade #-of-steps-per-bufsize
  73.     say string-to-translate-and-say
  74.     phoneme phoneme-string-to-say
  75.     exit
  76.  
  77. The 'fade' command is new to 1.01 and might need some explanation:
  78. What is does is merely reconfigure upd for future requests. By default
  79. fade is set to 0 which means that any playing sound will be cut off
  80. as soon as a new AREXX command arrives. Any other number indicates that
  81. when a new request arrives, first fade out the current sound by lowering
  82. the volume by the specified amount by each played buffer until volume reaches
  83. zero. As the observant reader realises, a value exceeding 64 will do 
  84. the same thing as 0 and a negative value may give nondesired effects...
  85.  
  86. 'say' and 'phoneme' are new as of 1.20 and their use should be obvious.
  87. These are really just a spin-off from what was added to the ID file. 
  88. Speech currently won't fade - I fail to see the beauty in fading it...
  89.  
  90. Well, there is actually one more command: 'Can it, Marvin'. This will 
  91. silently interrupt the current sample. (To be truely honest, ANY command
  92. will interrupt a sample - if it's known, it will be used, otherwise the
  93. sound just stops). Be careful with the 'rescan' command: if there is a 
  94. problem reading the new file, you will have no IDs at all...
  95.  
  96. The options are the same as for Zound except for the -n option that doesn't
  97. exist here (tell me you need it and I'll fix that too... sigh). Here's the
  98. list:
  99.  
  100.     -r rate    How fast to play the sample. Default is what is in the
  101.         8SVX header or 310 if it's a raw file. This is usually
  102.         reasonable - most 'raw' samples I've come across are either
  103.         310 or 155. Lower numbers will play the sample faster.
  104.  
  105.     -v volume    Ranges between 0 and 64, 64 being max and default.
  106.  
  107.     -s start    Possible offset from the beginning. Default 0.
  108.  
  109.     -l length    Possible length unless you want it all. Default is
  110.         length of the sample. Be careful with these two, or
  111.         you might get undesired results.
  112.  
  113.     -c cycles    How many times to play each buffer. Default 1. Not
  114.         very useful, but you can get a nice "mouse" effect by
  115.         setting this to 2 and playing twice as fast...
  116.  
  117.     -d        Show debug information. Note that this will appear on
  118.         the standard output of the DAEMON, not where you called 
  119.         it from (that is, the ARexx script or wherever).
  120.  
  121.     -L        Play the sample in the left speaker only. If it's a stereo
  122.         sample only the left channel samples are used.
  123.     -R        Same as '-L' but for right speaker.
  124.     -S        Play in both speakers even if it's a mono sample.
  125.         Default for these three options are of course what is in the
  126.         8SVX header or -L if it's a raw sample.
  127.  
  128. Examples:
  129. =========
  130.  
  131. * Example of usage (from WShell etc):
  132.  
  133.     "address play file 'sounds:chopper'
  134.     "address play fade 2
  135.     "address play id 2001
  136.         "address play rescan 'ram:upd.IDs'
  137.     "address play exit
  138.  
  139.  
  140. * If you are using the vanilla 2.0 AREXX you might have to create a file
  141.   like this:
  142.  
  143.     /* A test script in AREXX */
  144.  
  145.     address PLAY say "Hi there!"
  146.  
  147.   Then execute it with 'rx filename.rexx'
  148.  
  149.   Alternatively, you can give a command like this (note the tick [']):
  150.  
  151.     rx 'address PLAY say "Hi there!"
  152.  
  153.  
  154. * Say "emulations":
  155.  
  156.     address play say "-f -r -s100 E T phone home."
  157.     address play phoneme "-s200 YUWNAEZ PEH1TERSUN"
  158.  
  159.  
  160. NOTE: Arexx normally converts everything to UPPERCASE and might try to
  161. do arithmetics etc on filenames which is why it's generally a good idea
  162. to 'singelquote' all paths, IDs etc. If you're looking for the port
  163. 'the hard way' to send your own message, the name is "PLAY" in uppercase.
  164.  
  165. NOTE2: If you are REALLY in a hurry to get rid of upd you could do this:
  166.  1) Send a any dummy Arexx message (this will stop the sound)
  167.  2) Send a break C to upd - break still works when upd is idle.
  168. or
  169.  A) Send the exit message.
  170.  
  171. The last might sound much easier than the first unless you (like me)
  172. have a trapped DisplayBeep() that 'pings' via upd.  In this case,
  173. producing a DisplayBeep() and a break C is much simpler.  The order is
  174. not relevant since the break is "queued". 
  175.  
  176.  
  177. Hints:
  178. ======
  179.  
  180. Running upd from your SOUNDS: directory is a nice way to get rid of having
  181. you type the FULL path everytime you want to play a sample. (The daemon
  182. has no simple way of knowing WHERE you were when you sent the message 
  183. (that I know of) and therefore assumes it to be in the current directory)
  184.  
  185.  
  186. Files:
  187. ======
  188.  
  189.     s:upd.IDs
  190.  
  191. This file contains the IDs of your favourite samples like a database
  192. the is easily editable. File format:
  193.  
  194.  
  195. # Lines starting with '#' are comments
  196. # Id list for micro player daemon
  197. # Created 910201 Jonas Petersson (zaphod@magrathea.indic.se)
  198. # These sounds could be called for at certain situations
  199. # On severe error
  200. BUG    sounds:explosion -S
  201. # When asked for confirmation
  202. CONFIRM sounds:PressLeftMouseButton -L
  203. # Minor trouble
  204. ERROR   sounds:ImSorryDaveImAfraidICantDoThat -R
  205. # Going down...
  206. GURU    sounds:RoysDeathMonologueFromBladerunner -S
  207. # Personal shortcuts/favourites
  208. 2001    sounds:openpod -L sounds:hal -R
  209. # These should always work:
  210. ET      -SAY -r -f -p100 -F20000 -s110 E T phone home.
  211. AUTHOR  -PHONEME YUWNAEZ PEH1TERSUN
  212. # These are for Arq
  213. warn_write_protected    -SAY I'm afraid I can't do that.
  214. warn_insert_volume      -SAY I can't see it.
  215. warn_delete             -SAY Oh no.
  216. warn_printer            -SAY Printer trouble.
  217. error_task_held         -SAY You are in deep shit.
  218. error_read_write        -SAY Bad disk.
  219. error_general           -SAY Error.
  220. warn_general            -SAY Warning.
  221. query_general           -SAY Please.
  222. beep                    -SAY Beep.
  223.  
  224.  
  225. -SAY and -PHONEME are special "files" as of 1.20. These instead trigger
  226. the use of translator/narrator since some people don't have a lot of
  227. samples around. Remember that everything is defferent here - options
  228. come BEFORE the string and have other meanings than for samples. I've
  229. tried to keep the the same as the command 'say' uses:
  230.  
  231.     -m/-f    Male/Female
  232.     -n/-r    Natural/Robot
  233.     -p###    Pitch
  234.     -v###    Volume
  235.     -s###    Speed (rate really)
  236.     -F###    Sample frequency
  237.  
  238.     (Defaults are the same as for "say")
  239.  
  240. Removing entries will of course result in no sound (upd might mourn about
  241. it on the standard output though, unless you redirect it). Remember that
  242. ARexx might convert to uppercase unless you quote!
  243.  
  244. Feel free to add whatever you like. Could be nice with some standard though.
  245. If you make a program that uses several ID's it would be a good idea to have
  246. the same prefix for instance. 
  247.  
  248. Suggestions are welcome. Mjl's Arq is an example of a program that uses
  249. this feature. Read Arq's docs for details.
  250.  
  251. NOTE: It *IS* possible to have white space, lowercase etc in the IDs, but
  252. it might cause confusion if used. Be warned.
  253.  
  254. NOTE2: The file is scanned once when the program starts. If you make any
  255. changes to it, you'll have to restart the deamon.
  256.  
  257.  
  258. Return codes:
  259. =============
  260.  
  261. If the Arexx command returns 20, the secondary result code gives the
  262. reason for the failure:
  263.  
  264. 10    Can't allocate channels.
  265. 17    Can't open s:upd.IDs on request to play by ID.
  266. 18    Requested ID not found.
  267. 19    Trouble reading new ID file.
  268. 20    Error during parse of options.
  269. 21    Can't open file with sample.
  270. 22    File is IFF, but not FORM 8SVX.
  271. 23    Bad IFF file.
  272. 24    Bad CHAN length.
  273. 25    Bad VHDR length.
  274. 26    Can't open file 2nd time. (For stereo possibility)
  275. 30    Can't play backwards. (Weird options)
  276. 31    Can't allocate IOAudio structs.
  277. 32    Can't open ports for channels.
  278. 47    Can't open the translator library.
  279. 48    Translator won't use that string.
  280. 50    Bad options to -SAY/-PHONEME in ID line.
  281. 51    Can't open the narrator device.
  282. 52    Couldn't Allocate talk Signal bit.
  283. 53    Narrator won't do that. Usually bad pitch etc.
  284.  
  285.  
  286.  
  287. Being interrupted to do something else is not considered a failure. Note
  288. that this is true even if the current message has not been parsed yet.
  289. That is if UPD is sent these two messages (in order):
  290.  
  291.     address PLAY phoneme "Hi there!"
  292.     address PLAY say "Hi there!"
  293.     
  294. It will not parse the first one since it knows there is another one
  295. waiting and therefore returns 0 (OK) for the first even though it
  296. contains invalid phonemes. This should hardly be a problem and you 
  297. hardly want it to work the other way since that might slow down things
  298. significantly when you have a lot of queued requests (likely when trapping
  299. DisplayBeep() for instance). [Note that putting the above two messages
  300. after each other in a script WONT send them at the same time since upd
  301. doesn't release the first message until it's done!]
  302.  
  303.  
  304. Future enhancements:
  305. ====================
  306.  
  307. Maybe automatic detach (didn't work well in Aztec 5.0a, and I havn't really
  308. tried with 5.0d yet).
  309.  
  310. Probably not very much else - this is a simple sound daemon for minor
  311. background purposes of helping simple programs do more than DisplayBeep().
  312. I'd like to think of it as a complement to SPEAK: - if you want more
  313. you probably want it interactive. (Hmm, that's a thought - a SOUND: device)
  314.  
  315.  
  316.  
  317. Problem history: 
  318. ================
  319.  
  320. 1. If your sample is on a floppy (or a very slow HD) there might be 
  321.    some sounds of silence when the playing rate exceeds the loading
  322.    rate... 
  323. Fix: You can now specify the amount of memory to be used by upd when you
  324.    start the daemon as in: 'upd -b2000'. But note that a larger buffer also
  325.    makes a longer delay until you hear the first part of the sound - it
  326.    doesn't start until it has filled the first buffer.
  327.  
  328. 2. Stereo and Fibonachi packed samples not yet supported (there are loading
  329.    problems - play them with 'Zound' instead for now).
  330. Fix: Stereo is OK now if you use the above size option (it actually worked
  331.    in RAM: before too - but I didn't enable it for the prerelease). As for 
  332.    Fibonachi: it's not too hard to fix, but I've never seen anyone using it -
  333.    is it worth the effort? If you happen to have a Fib-sample - PLEASE send it
  334.    to me - I don't have the patience to reconstruct one by hand...
  335.  
  336. 3. Could hang forever if someone stole the channel. 
  337. Fix: So, I didn't check everything in 0.99 - now I do (I hope... ;-)
  338.  
  339. 4. -s and -l weren't used in 0.99, now they are.
  340.  
  341. 5. On request from the UK CDTV developers, FADE was added as of 1.01
  342.  
  343. 6. On request from various people, added option -p## at startup to make
  344. it simpler to raise priority for those demanding perfect sound but are
  345. to lazy to use "ChangeTaskPri" for it...
  346.  
  347. 7. Added speech and better command line parsing as of 1.20.
  348.  
  349. Thanks to mjl@alison.at for the idea.
  350.  
  351.  
  352. Distribution
  353. ============
  354.  
  355.   UPD is not public domain. A friend of mine advised me to call it
  356. "Freely Distributable Copyrighted" instead. That's close enough.  
  357. If You wish to include it with a commercial program feel free provided 
  358. that You send me a registered copy. And don't forget to mention me
  359. in the manual.
  360.  
  361.   As always, Fred Fish is free to include it in his library.
  362.  
  363.   Source code? You mean there is something to IMPROVE??? Right, send
  364. me a message then and I'll think about it...
  365.  
  366.  
  367.  
  368.  
  369.  
  370.     Jonas 'Zaphod' Petersson
  371.     Albrektsvagen 113A
  372.     S-603 53  Norrkoping
  373.     SWEDEN
  374.     Phone: +46 11 162517    (After four rings magrathea will let you leave
  375.                  a message for me if you log in as "guest".)
  376.  
  377.     zaphod@magrathea.indic.se                   /* At home */
  378.     zap@indic.se                    /* At work  - Quickest */
  379.  
  380.  
  381. Feel free to send comments, bug reports (huh?), money, coke, beer...
  382. [Sorry, girls are no longer allowed as I'm married now!]
  383.  
  384. Just a "Hi, I liked your program" is as good as a few bucks - I wrote this
  385. because I needed it, not to make money out of it...
  386.  
  387.  
  388.